#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <SDL2/SDL.h>
#include "SDLWindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    init();
}

SDLWindow sdlWin[2];
bool MainWindow::init()
{
    /* Initialize SDL */
    //if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
       if ( SDL_VideoInit(NULL) < 0)
    {
        printf( "SDL could not initialize! SDL Error: %s\n", SDL_GetError() );
        return false;
    }
    //sdlWin[0].init((const void *)ui->sdlWin1->winId());
    /* sdlWin[1].init((const void *)ui->sdlWin1->winId()); */
       sdlWin[0].init((const void *)this->winId());

    return true;
}

MainWindow::~MainWindow()
{
    SDL_Quit();

    delete ui;
}
